package com.my.createtype.singletion.staticstuff;

public class InnerStaticClass {
	
	public static Person p = new Person();
	
	int i = 1;
	static int j = 5;
	
	// 所谓静态内部类和静态变量不一样,静态变量只初始化一次,而静态内部类是不依赖于包装类的类,可以直接被实例化
	public static class StaticHolder {
		public StaticHolder() {
			System.out.println("static inner class init");
			//i ++;// Cannot make a static reference to the non-static field i
			j ++;
		}
	}
	
	// 非静态内部类必须依赖于外部类来实例化
	public class Holder {
		public Holder() {
			System.out.println("inner class init");
			i ++;
			j ++;
		}
	}
	
	public InnerStaticClass() {
		System.out.println("init...");
	}
}

class Person {
	public Person() {
		System.out.println("person init");
	}
}
